from rest_framework import serializers

from goods.models import GoodsChannel, GoodsChannelGroup, GoodsCategory


class ChannelSerializer(serializers.ModelSerializer):
    """
        频道序列化器
    """
    group = serializers.StringRelatedField(read_only=True)
    group_id = serializers.IntegerField()

    category = serializers.StringRelatedField(read_only=True)
    category_id = serializers.IntegerField()

    class Meta:
        model = GoodsChannel
        fields = '__all__'


class GoodsChannelGroupSerializer(serializers.ModelSerializer):
    """
    频道组序列化器
    """

    class Meta:
        model = GoodsChannelGroup
        fields = '__all__'


# class GoodsCategorySerializer(serializers.ModelSerializer):
#     """
#     一级分类序列化器
#     """
#
#     class Meta:
#         model = GoodsCategory
#         fields = ('id', 'name')
